# coding=utf-8
a = {
    "a": 0,
    "b": 0,
    "c": 0,
    "d": 0,
    "e": 0,
    "error": 0,
    "siyou": 0,
}


def ipcheck(ip: str):
    ipbit = ip.split('.')
    if len(ipbit) != 4 or '' in ipbit:
        return False
    for i in ipbit:
        if int(i) < 0 or int(i) > 255:
            return False
    return True


def siyoucheck(ip: str):
    ipbit = ip.split(".")
    ipbit = [int(x) for x in ipbit]
    if ipbit[0] == 10:
        return True
    elif ipbit[0] == 172 and 16 <= ipbit[1] <= 31:
        return True
    elif ipbit[0] == 192 and ipbit[1] == 168:
        return True
    else:
        return False


def maskcheck(mask: str):
    if mask == '255.255.255.255' or mask == '0.0.0.0':
        return False
    if not ipcheck(mask):
        return False
    masklist = mask.split(".")
    maskstr = ''
    if len(masklist) != 4 or '' in masklist: return False
    for i in masklist:
        i = bin(int(i))
        i = i[2:]
        i = "{:>08}".format(i)
        maskstr += i
    nums = maskstr.count('10')
    if nums >= 2 or '01' in maskstr: return False
    return True


while True:
    try:
        iplist = input().split('~')
        ip = iplist[0]
        mask = iplist[1]
        if ipcheck(ip):
            first = int(ip.split('.')[0])
            if first == 127 or first == 0:
                continue
            if maskcheck(mask):
                if siyoucheck(ip):
                    a['siyou'] += 1
                if 0 < first < 127:
                    a['a'] += 1
                elif 127 < first <= 191:
                    a['b'] += 1
                elif 192 <= first <= 223:
                    a['c'] += 1
                elif 224 <= first <= 239:
                    a['d'] += 1
                elif 240 <= first <= 255:
                    a['e'] += 1
            else:
                a['error'] += 1
        else:
            a['error'] += 1


    except:
        for i in a:
            print(a[i], end=' ')
        break
